<template>
	<view class="rtl" v-show="showbg">

		<view class="shopCartMenu" :style="$attrs.modelStyle">
			<view class="title">
				<view class="back">

				</view>
				{{$attrs.title}}
				<view class="reset">
					<!-- Reset -->
				</view>
			</view>
			<view class="content">
				<slot>

				</slot>
			</view>
			<view class="footer">
				<view class="" @click="showbg=false">
					{{t("Cancel")}}
				</view>
				<view class="Confrm" @click="Confrm">
					{{t("Confrm")}}<uv-icon class="flip" name="arrow-right" color="#fff"></uv-icon>
				</view>
			</view>

		</view>
		<view class="shield" @click="showbg=false">

		</view>
	</view>
</template>

<script setup>
	import {
		ref,
		useAttrs,
		defineExpose,
		onMounted
	} from "vue"
	import {
		useI18n
	} from "vue-i18n";

	const {
		t
	} = useI18n()
	const $attrs = useAttrs();
	const showbg = ref(false);
	const emit = defineEmits(["Confrm"]);
	onMounted(() => {
		if ($attrs.show) {
			showbg.value = $attrs.show
		}
	})
	const control = (bool) => {
		showbg.value = bool
	}

	const Confrm = () => {
		emit("Confrm")
	}
	defineExpose({
		control
	})
</script>

<style lang="scss" scoped>
	@import "@/static/css/index.scss";

	.shopCartMenu {
		position: fixed;
		z-index: 1;
		bottom: 0;
		left: 0;
		width: 100%;
		min-height: 40%;
		max-height: 60%;
		background: #fff;
		border-radius: 30rpx 30rpx 0 0;
		display: flex;
		flex-direction: column;

		.title {
			padding: 30rpx 20rpx;
			text-align: center;
			border-bottom: 1px solid #e9e9e9;
			position: relative;


			.reset {
				position: absolute;
				right: 20rpx;
				top: 50%;
				transform: translateY(-50%);
			}
		}

		.content {
			flex: 1;
			overflow-y: scroll;
			padding: 0 20rpx;
		}

		.footer {
			display: flex;
			align-items: center;
			justify-content: space-between;
			padding: 30rpx 40rpx;
			background: $primary-b;
			color: #fff;
			border-radius: 10rpx 10rpx 0 0;
			font-size: 28rpx;

			.Confrm {
				display: flex;
				align-items: center;
			}
		}
	}

	.shield {
		position: fixed;
		left: 0;
		top: 0;
		width: 100%;
		height: 100%;
		background: rgba(0, 0, 0, .5);
	}
</style>